package com.mvp.shq.washer.ui.recharge;

import com.mvp.shq.washer.entity.BaseResult;
import com.mvp.shq.washer.entity.RechargeMoney;
import com.mvp.shq.washer.http.BaseObserver;

import java.util.List;

/**
 * Created by Administrator on 2017/8/19.
 */

public class RechargePresenter extends RechargeConstract.Presenter {
    @Override
    public void onStart() {
        getMoney();
    }

    @Override
    public void getMoney() {
        model.rechargeMoney().subscribe(new BaseObserver<List<RechargeMoney>>(view) {
            @Override
            protected void onSuccees(BaseResult<List<RechargeMoney>> t) throws Exception {
                if (!t.isError()){
                    view.getRecharMoneySuccess(t.getData());
                }else {
                    view.getRecharMoneyFail(t.getMsg());
                }
            }

            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                view.getRecharMoneyFail("获取充值金额失败");
            }
        });
    }
}
